<?php

namespace app\common\model;

use think\Model;


class Scan extends Model
{

    

    

    // 表名
    protected $name = 'scan';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'type_data_text',
    ];



    public function getTypeDataList()
    {
        return ['0' => __('Type_data 0'), '1' => __('Type_data 1')];
    }

    public function getTypeDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type_data']) ? $data['type_data'] : '');
        $list = $this->getTypeDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function dynatown()
    {
        return $this->belongsTo('Dynatown', 'dynatown_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }



}
